package pojo;

import java.io.Serializable;

public enum PokeEnum implements Serializable {

    HEITAO_A(52,"A","黑桃"),
    HONGTAO_A(51,"A","红桃"),
    MEIHUA_A(50,"A","梅花"),
    FANGKUAI_A(49,"A","方块"),
    HEITAO_K(48,"K","黑桃"),
    HONGTAO_K(47,"K","红桃"),
    MEIHUA_K(46,"K","梅花"),
    FANGKUAI_K(45,"K","方块"),
    HEITAO_Q(44,"Q","黑桃"),
    HONGTAO_Q(43,"Q","红桃"),
    MEIHUA_Q(42,"Q","梅花"),
    FANGKUAI_Q(41,"Q","方块"),
    HEITAO_J(40,"J","黑桃"),
    HONGTAO_J(39,"J","红桃"),
    MEIHUA_J(38,"J","梅花"),
    FANGKUAI_J(37,"J","方块"),
    HEITAO_10(36,"10","黑桃"),
    HONGTAO_10(35,"10","红桃"),
    MEIHUA_10(34,"10","梅花"),
    FANGKUAI_10(33,"10","方块"),
    HEITAO_9(32,"9","黑桃"),
    HONGTAO_9(31,"9","红桃"),
    MEIHUA_9(30,"9","梅花"),
    FANGKUAI_9(29,"9","方块"),
    HEITAO_8(28,"8","黑桃"),
    HONGTAO_8(27,"8","红桃"),
    MEIHUA_8(26,"8","梅花"),
    FANGKUAI_8(25,"8","方块"),
    HEITAO_7(24,"7","黑桃"),
    HONGTAO_7(23,"7","红桃"),
    MEIHUA_7(22,"7","梅花"),
    FANGKUAI_7(21,"7","方块"),
    HEITAO_6(20,"6","黑桃"),
    HONGTAO_6(19,"6","红桃"),
    MEIHUA_6(18,"6","梅花"),
    FANGKUAI_6(17,"6","方块"),
    HEITAO_5(16,"5","黑桃"),
    HONGTAO_5(15,"5","红桃"),
    MEIHUA_5(14,"5","梅花"),
    FANGKUAI_5(13,"5","方块"),
    HEITAO_4(12,"4","黑桃"),
    HONGTAO_4(11,"4","红桃"),
    MEIHUA_4(10,"4","梅花"),
    FANGKUAI_4(9,"4","方块"),
    HEITAO_3(8,"3","黑桃"),
    HONGTAO_3(7,"3","红桃"),
    MEIHUA_3(6,"3","梅花"),
    FANGKUAI_3(5,"3","方块"),
    HEITAO_2(4,"2","黑桃"),
    HONGTAO_2(3,"2","红桃"),
    MEIHUA_2(2,"2","梅花"),
    FANGKUAI_2(1,"2","方块");

    private int index;
    private String name;
    private String color;

    private PokeEnum(int index,String name,String color){
        this.index = index;
        this.name = name;
        this.color = color;
    }

    public static PokeEnum getPoke(int index){
        for(PokeEnum poke : PokeEnum.values()){
            if (poke.getIndex() == index)
                return poke;
        }
        throw new RuntimeException("找不到该下标对应的牌");
    }


    public int getIndex() {
        return index;
    }

    public void setIndex(int index) {
        this.index = index;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }
}
